import Vue from "vue";
//引入VueRouter
import VueRouter from 'vue-router'
//引入路由组件
import LesseeCenter from '@/pages/lessee/LesseeCenter'
import SuperCenter from '@/pages/super/SuperCenter'
import Login from "@/components/Login";
import LesseeManage from "@/pages/super/lesseeManage/LesseeManage";
import ModifyLesseeInfo from "@/pages/super/lesseeManage/ModifyLesseeInfo";
import ViewLesseeFee from "@/pages/super/lesseeManage/ViewLesseeFee";
import UserManageOfSuper from "@/pages/super/userManage/UserManage";
import UserManageOfLessee from "@/pages/lessee/userManage/UserManage"
import PersonalCenter from "@/pages/lessee/personalCenter/PersonalCenter";
import ViewHistoryPersonalInfo from "@/pages/lessee/personalCenter/lesseePersonSubPage/ViewHistoryPersonalInfo";
import ModifyPersonalInfo from "@/pages/lessee/personalCenter/lesseePersonSubPage/ModifyPersonInfo";
import PersonalInfo from "@/pages/lessee/personalCenter/lesseePersonSubPage/PersonalInfo";
//用户
import UserCenter from '@/pages/user/UserCenter'
import UserModifyPersonalInfo from "@/pages/user/personalCenter/userPersonSubPage/UserModifyPersonalInfo";
import AnswerManage from "@/pages/user/answersManage/AnswerManage";
import UserPersonalHistoryInfo from "@/pages/user/personalCenter/userPersonSubPage/UserPersonalHistoryInfo";
import UserPersonalInfo from "@/pages/user/personalCenter/userPersonSubPage/UserPersonalInfo";
import UserInfo from "@/pages/lessee/userManage/UserInfo";
import questionnaireCenter from "@/pages/user/questionaire/Index";
import CreateNewQues from "@/pages/user/questionaire/CreateNewQues";
import PublishCenter from "@/pages/user/questionaire/PublishCenter";
import AnswerQuestionnaire from "@/pages/user/questionaire/AnswerQuestionnaire";
import Success from "@/components/Success";
import Sent from "@/pages/user/questionaire/Sent";
import LargeDataScreen from "@/pages/user/questionaire/LargeDataScreen";
import AnswerResult from "@/pages/user/questionaire/AnswerResult";


Vue.use(VueRouter)

//创建router实例对象，去管理一组一组的路由规则
export default new VueRouter({
    routes: [
        //登陆
        {
            path: '/',
            component: Login
        },
        //用户中心
        {
            path: '/user-center',
            component: UserCenter,
            children: [
                {
                    path: 'answers-manage',
                    component: AnswerManage,
                },
                {
                    path: 'personal-center',
                    component: () => import("@/pages/user/personalCenter/UserPersonalCenter"),
                    children: [
                        {
                            path: 'modify-personal-info',
                            component: UserModifyPersonalInfo,
                        },
                        {
                            path: 'view-personal-history',
                            component: UserPersonalHistoryInfo,
                        },
                        {
                            path: 'user-personal-info',
                            component: UserPersonalInfo,
                        }
                    ]

                },
                {
                    path: "questionnaireCenter",
                    component: questionnaireCenter,
                    children: [
                        {
                            name: 'createNewQues',
                            path: 'createNewQues',
                            component: CreateNewQues,
                        },
                        {
                            name: 'publishCenter',
                            path: 'publishCenter',
                            component: PublishCenter,
                        },
                        {
                            name: 'answerQuestionnaire',
                            path: 'answerQuestionnaire',
                            component: AnswerQuestionnaire,
                        },
                        {
                            name: 'sent',
                            path: 'sent',
                            component: Sent,
                        },
                        {
                            name: 'largeDataScreen',
                            path: 'largeDataScreen',
                            component: LargeDataScreen,
                        },
                        {
                            name: 'answerResult',
                            path: 'answerResult',
                            component: AnswerResult,
                        }
                    ]
                }
            ]
        },
        //租户中心
        {
            path: '/lessee-center',
            component: LesseeCenter,
            children: [
                {
                    path: 'user-manage',
                    component: UserManageOfLessee,
                    children: [
                        {
                            path: 'user-info',
                            component: UserInfo,
                        },
                        {
                            path: 'modify-user-info',
                            component: ModifyPersonalInfo,
                        }
                    ]
                },
                {
                    path: 'personal-center',
                    component: PersonalCenter,
                    children: [
                        {
                            path: 'personal-info',
                            component: PersonalInfo,
                        },
                        {
                            path: 'view-personal-history',
                            component: ViewHistoryPersonalInfo
                        },
                        {
                            path: 'modify-personal-info',
                            component: ModifyPersonalInfo,
                        }
                    ]
                }
            ]
        },
        //超管中心
        {
            path: '/super-center',
            component: SuperCenter,
            children: [
                {
                    path: 'lessee-manage',
                    component: LesseeManage,
                },
                {
                    path: 'modify-lessee-info',
                    component: ModifyLesseeInfo
                },
                {
                    path: 'view-lessee-fee',
                    component: ViewLesseeFee,
                },
                {
                    path: 'user-manage',
                    component: UserManageOfSuper,
                }
            ]
        },
        //成功
        {
            path: '/success',
            name: 'success',
            component: Success,
        }
    ]
});